Skip to content

Use bitcoin core's txospenderindex to find spending transactions#3279

Draft
sstone wants to merge 3 commits intomasterfrom
use-txospenderindex
Draft

Use bitcoin core's txospenderindex to find spending transactions#3279
sstone wants to merge 3 commits intomasterfrom
use-txospenderindex

Conversation

@sstone
Copy link
Copy Markdown
Member

@sstone sstone commented Apr 2, 2026

Eclair now requires that bitcoin core's txospenderindex (added in version 31.0) is available and synced, and will fail to start if it is not.

Our Watcher will use the txospenderindex` to find spending transactions instead of scanning blocks (which was both expensive and limited as we would only scan a small number of blocks into the past).

Deployment note:

You must enable the new index on bitcoin core with txospenderindex=1 and wait until it is synchronised before you start eclair. Syncing the index from scratch will take a few hours, during which bitcoin core is usable (indexes are independent) but make be slower to respond.
You can also copy the index from another node (that is running the same version), just copy the entire .bitcoin/indexes/txospenderindex directory.

The index requires an additional 88Gb as of block 944339.

@sstone sstone changed the title Use bitcoin core's txospenderindex find spending transaction Use bitcoin core's txospenderindex to find spending transaction Apr 2, 2026
@sstone sstone changed the title Use bitcoin core's txospenderindex to find spending transaction Use bitcoin core's txospenderindex to find spending transactions Apr 2, 2026
@sstone sstone force-pushed the use-txospenderindex branch 4 times, most recently from 513211e to d3d7f3c Compare April 22, 2026 14:33
@sstone sstone force-pushed the use-txospenderindex branch 3 times, most recently from 00d357b to 7b7eb49 Compare April 30, 2026 11:23
sstone and others added 3 commits May 7, 2026 09:07
If bitcoin core's txospenderindex is enabled and sync, we'll automatically use it to find transactions that spent our channels.
On startup, eclair will check that both txindex and txospenderindex are enabled and synced, and will stop if they're not.
Block scanning code used to find spending transactions is removed, we just use the txospenderindex now.
@sstone sstone force-pushed the use-txospenderindex branch from 7b7eb49 to cd31b14 Compare May 7, 2026 12:01
@pm47
Copy link
Copy Markdown
Member

pm47 commented May 7, 2026

As discussed offline, imo we should make txospenderindex a hard requirement (just like txindex) and drop the block scanning implementation altogether. This was just really a hacky workaround. Simplification FTW!

@sstone
Copy link
Copy Markdown
Member Author

sstone commented May 7, 2026

As discussed offline, imo we should make txospenderindex a hard requirement (just like txindex) and drop the block scanning implementation altogether. This was just really a hacky workaround. Simplification FTW!

done in cd31b14. Eclair won't start if the index is not enabled and synced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants